<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <footer th:fragment="nav">
        <!-- 用户信息 -->
        <div class="tpl-sidebar-user-panel">
            <div class="tpl-user-panel-slide-toggleable">
                <div class="tpl-user-panel-profile-picture">
                    <img th:src="@{/img/user03.png}" alt="" data-toggle="modal" data-target="#myimportheadModal">
                </div>
                <span class="user-panel-logged-in-text" th:text="${session.userInfo.adminAccount}">
              <i class="am-icon-circle-o am-text-success tpl-user-panel-status-icon"></i>
              禁言小张
          </span>
                <a href="javascript:;" class="tpl-user-panel-action-link" data-toggle="modal" data-target="#myModal"> <span class="am-icon-pencil"></span> 账号设置</a>
            </div>
        </div>

        <!--账号设置模态框-->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-top: 300px">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel">账号设置</h4>
                    </div>
                    <div id="model">
                        <form>
                            用户名：<input type="text" th:placeholder="${session.userInfo.adminAccount}" th:value="${session.userInfo.adminAccount}" id="adminName" readonly><br>
                            原密码：<input type="password" placeholder="请输入原密码" id="oldpwd"><br>
                            新密码：<input type="password" placeholder="请输入新密码" id="newpwd">
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" onclick="changepwd()">提交</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>

<!--        &lt;!&ndash;导入模态框&ndash;&gt;
        <div class="modal fade" id="myimportheadModal" tabindex="-1" role="dialog" aria-labelledby="myimportheadModalLabel" aria-hidden="true" style="margin-top: 300px">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myimportheadModalLabel">请选择图片</h4>
                    </div>
                    请选择需要上传的文件：<input type="file" name="file" id="importfile">
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="importhead()">提交</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>&lt;!&ndash; /.modal-content &ndash;&gt;
            </div>&lt;!&ndash; /.modal &ndash;&gt;
        </div>-->

        <!-- 菜单 -->
        <ul class="sidebar-nav">
            <li class="sidebar-nav-heading">Components <span class="sidebar-nav-heading-info"> 附加组件</span></li>
            <li class="sidebar-nav-link">
                <a class="active" href="javascript:" onclick="switchPage('mainPage')">
                    <i class="am-icon-home sidebar-nav-link-logo"></i> 首页
                </a>
            </li>

            <!--                网站管理-->
            <li class="sidebar-nav-link">
                <a href="javascript:;" class="sidebar-nav-sub-title">
                    <i class="am-icon-table sidebar-nav-link-logo"></i> 网站管理
                    <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                </a>
                <ul class="sidebar-nav sidebar-nav-sub">
                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('personManager')" th:onclick="selectAdmin()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 人员管理
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a  href="javascript:" onclick="switchPage('customerManager')" th:onclick="selectAllUser()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 用户管理
                        </a>
                    </li>
                </ul>
            </li>
            <!--            项目管理-->
            <li class="sidebar-nav-link">
                <a href="javascript:;" class="sidebar-nav-sub-title">
                    <i class="am-icon-table sidebar-nav-link-logo"></i> 项目管理
                    <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                </a>
                <ul class="sidebar-nav sidebar-nav-sub">
                    <li class="sidebar-nav-link">
                        <a  href="javascript:" onclick="switchPage('projectbreif')" th:onclick="selectinvest()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 项目简介
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('afterLoanManager')" th:onclick="selectafterloan()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 项目贷后管理
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('commentManager')" th:onclick="selectcomment()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 项目评论管理
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('company')" th:onclick="selectcompany()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 项目公司管理
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('riskManager')" th:onclick="selectrisk()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 项目风险投资管理
                        </a>
                    </li>

                </ul>
            </li>
            <!--用户贷款管理-->
            <li class="sidebar-nav-link">
                <a href="javascript:;" class="sidebar-nav-sub-title">
                    <i class="am-icon-table sidebar-nav-link-logo"></i> 用户贷款管理
                    <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                </a>
                <ul class="sidebar-nav sidebar-nav-sub">
                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('borrow')" th:onclick="selectBorrow()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 贷款管理
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('repay')" th:onclick="selectUserRepay()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 用户还贷月份款管理
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('chargeRecord')"  th:onclick="selectAllUserCharge()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 用户充值记录
                        </a>
                    </li>
                </ul>
            </li>

            <!--资金管理-->
            <li class="sidebar-nav-link">
                <a href="javascript:;" class="sidebar-nav-sub-title">
                    <i class="am-icon-table sidebar-nav-link-logo"></i> 资金管理
                    <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                </a>
                <ul class="sidebar-nav sidebar-nav-sub">
                    <li class="sidebar-nav-link">
                        <a  href="javascript:" onclick="switchPage('discountManager')" th:onclick="selectCoupon()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 优惠券管理
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a  href="javascript:" onclick="switchPage('creditsManager')" th:onclick="selectScore()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 用户积分管理
                        </a>
                    </li>
                </ul>
            </li>

            <!--日志管理-->
            <li class="sidebar-nav-link">
                <a href="javascript:;" class="sidebar-nav-sub-title">
                    <i class="am-icon-table sidebar-nav-link-logo"></i> 日志管理
                    <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                </a>
                <ul class="sidebar-nav sidebar-nav-sub">

                    <li class="sidebar-nav-link">
                        <a  href="javascript:" onclick="searchRecord('selectUser')">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 用户登录日志
                        </a>
                    </li>


                    <li class="sidebar-nav-link">
                        <a  href="javascript:" onclick="searchRecord('selectAdmin')">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 管理员登录日志
                        </a>
                    </li>




                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="searchRecord('selectSystem')">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 系统操作日志
                        </a>
                    </li>
                </ul>
            </li>

            <li class="sidebar-nav-link">
                <a href="javascript:;" class="sidebar-nav-sub-title">
                    <i class="am-icon-table sidebar-nav-link-logo"></i> 其他管理
                    <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico"></span>
                </a>
                <ul class="sidebar-nav sidebar-nav-sub">
                    <li class="sidebar-nav-link">
                        <a  href="javascript:" onclick="switchPage('operationPerformance')" th:onclick="selectOperationPerformance()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 运营数据
                        </a>
                    </li>


                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('newsRecord1')" th:onclick="selectNewsRecord()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 实时资讯
                        </a>
                    </li>

                    <li class="sidebar-nav-link">
                        <a href="javascript:" onclick="switchPage('announce')" th:onclick="selectAnnounce()">
                            <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 网页公告
                        </a>
                    </li>
                </ul>
            </li>
        </ul>

        <script>
            function selectAdmin() {
                $.ajax({
                    url:"/p2p/manage/getAllManage",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectAllUser() {
                $.ajax({
                    url:"/p2p/userManage/getAllUser",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectAllUserCharge() {
                $.ajax({
                    url:"/p2p/charge/getUserCharge",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectCoupon() {
                $.ajax({
                    url:"/p2p/coupon/getcouponbycons",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }


            function selectUserRepay() {
                $.ajax({
                    url:"/p2p/myrepay/getUserRepay",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }


            function selectBorrow() {
                $.ajax({
                    url:"/p2p/myborrow/getUserBorrow",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectScore() {
                $.ajax({
                    url:"/p2p/score/getscorebycons",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        console.log(data);
                        $("#content").html(data)
                    }
                })
            }

            function logout() {
                $.ajax({
                    url:"/p2p/admin/logout",
                    type:"get",
                    dataType:"text",
                    success:function (data) {
                        if(data==1){
                            location.href="login"
                        }
                    }
                })
            }

            function selectcompany() {
                $.ajax({
                    url:"/p2p/mycompany/getmycompanydetail",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }


            function selectcomment() {
                $.ajax({
                    url:"/p2p/myCommentManager/getCommentDetail",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectrisk() {
                $.ajax({
                    url:"/p2p/myrisk/getAllRisk",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectafterloan() {
                $.ajax({
                    url:"/p2p/afterloans/findAllafterloans",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectinvest() {
                $.ajax({
                    url:"/p2p/projectbreif/getallprojectbreif",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            //时实咨询
            function selectNewsRecord() {
                $.ajax({
                    url:"/p2p/newsRecord/selectNewRecord",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectAnnounce() {
                $.ajax({
                    url:"/p2p/announce/selectAnnounce",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }

            function selectOperationPerformance() {
                $.ajax({
                    url:"/p2p/operationPerformance/selectOperationPerformance",
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }
            var list=[{"id": 1, "name": "优惠券管理","url":"/coupon/getcouponbycons"},
                {"id": 2, "name": "用户积分管理","url":"/score/getscorebycons"},
                {"id": 3, "name": "人员管理","url":"/manage/getAllManage"},
                {"id": 4, "name": "用户管理","url":"/userManage/getAllUser"},
                {"id": 5, "name": "项目简介","url":"/projectbreif/getallprojectbreif"},
                {"id": 6, "name": "项目贷后管理","url":"/afterloans/findAllafterloans"},
                {"id": 7, "name": "项目评论管理","url":"/myCommentManager/getCommentDetail"},
                {"id": 8, "name": "项目公司管理","url":"/mycompany/getmycompanydetail"},
                {"id": 9, "name": "项目风险投资管理","url":"/myrisk/getAllRisk"},
                {"id": 10, "name": "贷款管理","url":"/myborrow/getUserBorrow"},
                {"id": 11, "name": "用户还贷月份款管理","url":"/myrepay/getUserRepay"},
                {"id": 12, "name": "用户充值记录","url":"/charge/getUserCharge"},
                {"id": 13, "name": "运营数据","url":"/operationPerformance/selectOperationPerformance"},
                {"id": 14, "name": "实时资讯","url":"/newsRecord/selectNewRecord"},
                {"id": 14, "name": "网页公告","url":"/announce/selectAnnounce"}
                ];
            $(document).ready(function() {
                var seach = $("#seach");
                seach.keyup(function (event) {
                    var seachText = $("#seach").val();
                    if (seachText != "") {
                        var tab = "<ul class=\"am-list\">";
                        $.each(list, function (id, item) {
                            if (item.name.indexOf(seachText) != -1) {
                                tab+="<li style='line-height: 25px;width: 183px'><a href=\"javascript:;\" onclick=\"tolist('"+item.url+"')\">"+item.name+"</a></li>"
                            }
                        });
                        tab += "</ul>";
                        $("#div").html(tab);
                        document.getElementById("div").style.display="block"
                        tab = "";
                    } else {
                        $("#div").html("");
                    }
                });
            })
            function tolist(url) {
                document.getElementById("div").style.display="none"
                $.ajax({
                    url:"/p2p"+url,
                    type:"get",
                    dataType:"html",
                    success:function (data) {
                        $("#content").html(data)
                    }
                })
            }
            function changepwd() {
                var adminName = $('#adminName').val();
                var oldpwd_s = $('#oldpwd').val();
                var newpwd_s = $('#newpwd').val();
                var oldpwd=infoEncrypt(adminName,oldpwd_s)
                var newpwd=infoEncrypt(adminName,newpwd_s)
                $.ajax({
                    url: "admin/changepwd",
                    data: {"adminName":adminName,"oldpwd":oldpwd,"newpwd":newpwd},
                    type: 'post',
                    dataType: 'text',
                    success:function(data){
                        alert(data)
                    }
                })
            }
            function infoEncrypt(userName, password) {
                var str1 = $.md5(password)
                var str2 = $.md5(str1+userName)
                return str2;
            }
            /*导入头像*/
 /*           function importhead() {
                var form = new FormData();
                form.append("file", document.getElementById("importfile").files[0]);
                $.ajax({
                    url:"/p2p/admin/importhead",
                    data:form,
                    type:"post",
                    dataType:"text",
                    processData: false,
                    contentType: false,
                    success:function (data) {
                        if(data==1){
                            alert("修改成功")
                        }else{
                            alert("修改失败")
                        }
                    },
                })
            }*/
        </script>

    </footer>


    <footer th:fragment="header">
        <div class="am-fl tpl-header-logo">
            <a href="javascript:;"><img th:src="@{/img/logo.png}" alt=""></a>
        </div>
        <!-- 右侧内容 -->
        <div class="tpl-header-fluid">
            <!-- 侧边切换 -->
            <div class="am-fl tpl-header-switch-button am-icon-list">
                    <span>

                </span>
            </div>
            <!-- 搜索 -->
            <div class="am-fl tpl-header-search">
                <form class="tpl-header-search-form" action="javascript:;">
                    <button class="tpl-header-search-btn am-icon-search"></button>
                    <!--<input class="tpl-header-search-box" type="text" id="autoComplete" placeholder="搜索内容...">-->
                    <input id="seach" placeholder="搜索内容..." class="selectOption"/><div id="div" style="margin-left: 29px"></div>
                </form>
            </div>
            <!-- 其它功能-->
            <div class="am-fr tpl-header-navbar">
                <ul>
                    <!-- 欢迎语 -->
                    <li class="am-text-sm tpl-header-navbar-welcome">
                        <a href="javascript:;">欢迎你, <span th:text="${session.userInfo.adminAccount}">Amaze UI</span> </a>
                    </li>

<!--                    &lt;!&ndash; 新邮件 &ndash;&gt;
                    <li class="am-dropdown tpl-dropdown" data-am-dropdown>
                        <a href="javascript:;" class="am-dropdown-toggle tpl-dropdown-toggle" data-am-dropdown-toggle>
                            <i class="am-icon-envelope"></i>
                            <span class="am-badge am-badge-success am-round item-feed-badge">4</span>
                        </a>
                        &lt;!&ndash; 弹出列表 &ndash;&gt;
                        <ul class="am-dropdown-content tpl-dropdown-content">
                            <li class="tpl-dropdown-menu-messages">
                                <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                    <div class="menu-messages-ico">
                                        <img th:src="@{/img/user04.png}" alt="">
                                    </div>
                                    <div class="menu-messages-time">
                                        3小时前
                                    </div>
                                    <div class="menu-messages-content">
                                        <div class="menu-messages-content-title">
                                            <i class="am-icon-circle-o am-text-success"></i>
                                            <span>夕风色</span>
                                        </div>
                                        <div class="am-text-truncate"> Amaze UI 的诞生，依托于 GitHub 及其他技术社区上一些优秀的资源；Amaze UI 的成长，则离不开用户的支持。 </div>
                                        <div class="menu-messages-content-time">2016-09-21 下午 16:40</div>
                                    </div>
                                </a>
                            </li>

                            <li class="tpl-dropdown-menu-messages">
                                <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                    <div class="menu-messages-ico">
                                        <img th:src="@{/img/user02.png}" alt="">
                                    </div>
                                    <div class="menu-messages-time">
                                        5天前
                                    </div>
                                    <div class="menu-messages-content">
                                        <div class="menu-messages-content-title">
                                            <i class="am-icon-circle-o am-text-warning"></i>
                                            <span>禁言小张</span>
                                        </div>
                                        <div class="am-text-truncate"> 为了能最准确的传达所描述的问题， 建议你在反馈时附上演示，方便我们理解。 </div>
                                        <div class="menu-messages-content-time">2016-09-16 上午 09:23</div>
                                    </div>
                                </a>
                            </li>
                            <li class="tpl-dropdown-menu-messages">
                                <a href="javascript:;" class="tpl-dropdown-menu-messages-item am-cf">
                                    <i class="am-icon-circle-o"></i> 进入列表…
                                </a>
                            </li>
                        </ul>
                    </li>

                    &lt;!&ndash; 新提示 &ndash;&gt;
                    <li class="am-dropdown" data-am-dropdown>
                        <a href="javascript:;" class="am-dropdown-toggle" data-am-dropdown-toggle>
                            <i class="am-icon-bell"></i>
                            <span class="am-badge am-badge-warning am-round item-feed-badge">5</span>
                        </a>

                        &lt;!&ndash; 弹出列表 &ndash;&gt;
                        <ul class="am-dropdown-content tpl-dropdown-content">
                            <li class="tpl-dropdown-menu-notifications">
                                <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                    <div class="tpl-dropdown-menu-notifications-title">
                                        <i class="am-icon-line-chart"></i>
                                        <span> 有6笔新的销售订单</span>
                                    </div>
                                    <div class="tpl-dropdown-menu-notifications-time">
                                        12分钟前
                                    </div>
                                </a>
                            </li>
                            <li class="tpl-dropdown-menu-notifications">
                                <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                    <div class="tpl-dropdown-menu-notifications-title">
                                        <i class="am-icon-star"></i>
                                        <span> 有3个来自人事部的消息</span>
                                    </div>
                                    <div class="tpl-dropdown-menu-notifications-time">
                                        30分钟前
                                    </div>
                                </a>
                            </li>
                            <li class="tpl-dropdown-menu-notifications">
                                <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                    <div class="tpl-dropdown-menu-notifications-title">
                                        <i class="am-icon-folder-o"></i>
                                        <span> 上午开会记录存档</span>
                                    </div>
                                    <div class="tpl-dropdown-menu-notifications-time">
                                        1天前
                                    </div>
                                </a>
                            </li>


                            <li class="tpl-dropdown-menu-notifications">
                                <a href="javascript:;" class="tpl-dropdown-menu-notifications-item am-cf">
                                    <i class="am-icon-bell"></i> 进入列表…
                                </a>
                            </li>
                        </ul>
                    </li>-->

                    <!-- 退出 -->
                    <li class="am-text-sm">
                        <a href="javascript:;" onclick="logout()">
                            <span class="am-icon-sign-out"></span> 退出
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </footer>

    <footer th:fragment="skin">
        <div class="tpl-skiner-toggle am-icon-cog">
        </div>
        <div class="tpl-skiner-content">
            <div class="tpl-skiner-content-title">
                选择主题
            </div>
            <div class="tpl-skiner-content-bar">
                <span class="skiner-color skiner-white" data-color="theme-white"></span>
                <span class="skiner-color skiner-black" data-color="theme-black"></span>
            </div>
        </div>
    </footer>
</head>
</html>
